package ar.com.mooral.activities;

import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Vector;

import android.app.Activity;
import android.content.ComponentName;
import android.content.Intent;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ScrollView;
import android.widget.TextView;
import ar.com.mooral.crohn.application.CrohnContext;
import ar.com.mooral.data.Depositions;
import ar.com.mooral.data.FoodList;
import ar.com.mooral.data.SexualActivityIncidence;
import ar.com.mooral.pojo.MedicationPojo;


public class MedicationAddDoses extends CrohnActivity {
	
	
	private MedicationPojo pojo;
	
	protected void onStart() {
		super.onStart();

		
		if(CrohnContext.isPojoLoaded()){
			((TextView)findViewById(R.id.txtMedicationAddDosesQuantity)).setText( pojo.getDosesQuantity()!=null ? pojo.getDosesQuantity() : "" );
			((TextView)findViewById(R.id.txtMedicationAddDosesUnits)).setText( pojo.getDosesUnits()!=null ? pojo.getDosesUnits() : "" );
		}
		
	}

	
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.medication_add_doses);
        
		pojo = (MedicationPojo)CrohnContext.getPojo();

		// SAVE
		TextView lblMedicationAddDosesSave = (TextView) findViewById(R.id.lblMedicationAddDosesSave);
		lblMedicationAddDosesSave.setOnClickListener (new View.OnClickListener() {
		    public void onClick(View view) {
		    	
		    	pojo.setDosesQuantity(((TextView)findViewById(R.id.txtMedicationAddDosesQuantity)).getText().toString());
		    	pojo.setDosesUnits(((TextView)findViewById(R.id.txtMedicationAddDosesUnits)).getText().toString());
		    	
		    	finish();
		    }
		});		
    
        // CANCEL
		TextView lblMedicationAddDosesCancel = (TextView) findViewById(R.id.lblMedicationAddDosesCancel);
        lblMedicationAddDosesCancel.setOnClickListener (new View.OnClickListener() {
		    public void onClick(View view) {
		    	finish();
		    }
		});		
        
    }
    
    
}
